<? 
require_once("admin/classes/check_customer_session.php");
check_customer_session(); 
?>
<?php require_once('include/header.php'); ?>
<?
if($_GET['action'] == "CHANGE")
{
	$query_data = "Update scrap set approve ='Y' where scrap_id=".$_REQUEST['sid'];
	$result_update	= mysql_query ( $query_data ) or die(mysql_error());
}

if($_GET['action'] == "CANCEL")
{
	$query_data = "Delete from scrap where scrap_id=".$_REQUEST['sid'];
	$result_update	= mysql_query ( $query_data ) or die(mysql_error());
}

if(!isset($_REQUEST['dir'])){
	$dir = "DESC";
} else {
	$dir = $_REQUEST['dir'];
}
?>
<? if ($_REQUEST['b'] == ""){ $b=0; } else { $b = $_REQUEST['b'];} ?>

      <div id="middle_container_for_innerpage">
      <div id="innerpage_top_image"><img src="images/images/innerpage_top_corner_820x5.jpg"  height="5" /></div> 
      <div id="middle_inner_container">
      <?php require_once('include/left_menu.php'); ?>
        
        <div id="inner_page_middle_data">
        	<div class="main">
  <table width="100%">
    <tr>
      <td valign="top"><table width="100%" border="0" cellspacing="0">
      <tr>
        <td align="center" class="Astrobluebighead">Delete Your Scraps or Approve<br />
		  <span class="NewBlackSmall">
              <?
		
		$sql = "SELECT customer.customer_id, customer.name, customer.surname, scrap.scrap, scrap.scrap_id, customer.image_1 FROM scrap INNER JOIN customer ON scrap.from = customer.customer_id WHERE scrap.to =".$_SESSION['ep_customer_id'];
//	$sql.= "and customer.status = 'Y'";

		$rs = mysql_query($sql) or die(mysql_error());
		$cnt = mysql_num_rows($rs);
		$sql .= " LIMIT $b, $pagecount_1";
		$rs = mysql_query($sql) or die(mysql_error());


		?>
              <!--		display dynamic data -->
              <?
	if(@mysql_num_rows($rs)>0){
				?>
              Total number of Scraps <?php echo $b; ?> to <?php echo $cnt+ $b; ?> out of <?php echo $cnt; ?> </span><br />
              <?	while($row=mysql_fetch_array($rs)){ ?>        
              </span></td>
      </tr>
      <tr>
        <td class="formfield"></td>
      </tr>
      <tr>
        <td class="formfield"></td>
      </tr>
      <tr>
        <td class="formfield"><table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#008000">
          <tr>
            <td class="advSearchBackground">From</td>
            <td class="advSearchBackground">Scrap</td>
            <td class="advSearchBackground">Approve Or Delete</td>
          </tr>
          <tr>
            <td><?php echo $row['name']; ?> <?php echo $row['surname']; ?><br>
                <?if($row['image_1']){?>
                <a href="profile.php?cid=<?php echo $row['customer_id']; ?>"><img src="uploaded/<?=$row['image_1']?>" width="80" height="80" border="0" class="image-border1"></a>
                <?}else{?>
                <a href="profile.php?cid=<?php echo $row['customer_id']; ?>"><?if($row['gender']="Male"){?><img src="images/images/default_eparinay_groom.jpg" width="90" height="90" border="0" class="image_border" ><?} else{?>
				<img src="images/images/default_eparinay_bride.jpg" width="90" height="90" border="0" class="image_border" ><?}?></a>
                <?}?>            </td>
            <td><?php echo $row['scrap']; ?></td>
            <td width="20%" align="center" class="AstroGoLink"><a href="JavaScript:if(confirm('You want to Approve this Scrap?')){self.location.href='see_scraps.php?sid=<?php echo $row['scrap_id']; ?>&action=CHANGE';}"
							class="AstroGoLink">Approve</a>&nbsp;| <a href="JavaScript:if(confirm('You want to Delete this Scrap?')){self.location.href='see_scraps.php?sid=<?php echo $row['scrap_id']; ?>&action=CANCEL';}"
							class="AstroGoLink">Delete</a></td>
          </tr>
</table><?}

	} else {?>
          <p align="center" class="title"><br />
          </p>
        <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td class="mesg" colspan="6">Sorry !! No results found.</td>
            </tr>
            <?}?>
            <!--pagecount table starts here-->
            <? if ($cnt > $pagecount_1) {?>
            <tr>
              <td class="mesg" colspan="6"><?
						$qrystr="&sortBy=$sortBy&dir=$dir&con=".$conn;
						displayPageNo($b,$cnt,$qrystr,"link-pagination",$pagecount_1);
					?>              </td>
            </tr>
            <? } ?>
        </table></td>
      </tr>
    </table></td>
    </tr>
  </table>
</div>
        </div>
        

       
       
      </div> 
      <div id="corner_container_bottom_for_innerpage"><img src="images/images/innerpage_bottom_corner_820x10.jpg"  height="10" /></div>
    </div> 
      <!-- middle_container ends -->
    
    
        
    
<?php require_once('include/footer.php'); ?>
